summaryrefslogtreecommitdiff
path: root/arch/arm
diff options
context:
space:
mode:
authorSimon Que <sque@ti.com>2010-03-19 13:38:56 -0600
committerHari Kanigeri <h-kanigeri2@ti.com>2010-07-09 17:57:30 -0500
commit013cae6745961d2d01939bd75758e410b8fc9aaf (patch)
tree24148d27ee64c306ce6d9c221b5e5babce4a45a0 /arch/arm
parent15bbd58209e995c73f787070f3ce41fb0b4a1678 (diff)
SYSLINK: ipc - heapbufmp module created from heapbuf module
Added new module heapbufmp for SysLink-2.0. This version incorporates the changes for improved ease of programming by the user. It replaces the old heapbuf module. New features: - Added heapbufmp_module pointer to heapbufmp_state. - More user-friendly API. - heapbufmp_open opens an existing heapbufmp by name. - heapbufmp_open_by_addr opens an existing heapbufmp by shared address. Fixed bugs in heapbufmp: - heapbufmp_alloc was using obj->params.exact instead of obj->exact to check whether exact allocation was required. - heapbufmp_open_by_addr was using the list iteration macro the wrong way. - heapbufmp_ioctl_open_by_addr was not converting srptr to normal address before passing it to heapbufmp_open_by_addr. - heapbufmp_ioctl_close was passing the handle rather than the handle ptr to heapbufmp_close. Also added some WARN_ONs to heapbufmp error checks. Signed-off-by: Simon Que <sque@ti.com> Signed-off-by: Suman Anna <s-anna@ti.com>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/plat-omap/include/syslink/heapbuf.h152
-rw-r--r--arch/arm/plat-omap/include/syslink/heapbuf_ioctl.h215
-rw-r--r--arch/arm/plat-omap/include/syslink/heapbufmp.h253
-rw-r--r--arch/arm/plat-omap/include/syslink/heapbufmp_ioctl.h232
4 files changed, 485 insertions, 367 deletions
diff --git a/arch/arm/plat-omap/include/syslink/heapbuf.h b/arch/arm/plat-omap/include/syslink/heapbuf.h
deleted file mode 100644
index 3667c4675d49..000000000000
--- a/arch/arm/plat-omap/include/syslink/heapbuf.h
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * heapbuf.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 _HEAPBUF_H_
-#define _HEAPBUF_H_
-
-#include <linux/types.h>
-#include <heap.h>
-#include <listmp.h>
-
-/*!
- * @def LISTMP_MODULEID
- * @brief Unique module ID.
- */
-#define HEAPBUF_MODULEID (0x4cd5)
-
-/*
- * Creation of Heap Buf succesful.
-*/
-#define HEAPBUF_CREATED (0x05251995)
-
-/*
- * Version.
- */
-#define HEAPBUF_VERSION (1)
-
-/*
- * Structure defining config parameters for the HeapBuf module.
- */
-struct heapbuf_config {
- u32 max_name_len; /* Maximum length of name */
- bool use_nameserver; /* To have this module use the NameServer or not */
- bool track_max_allocs; /* Track the maximum number of allocated blocks */
-};
-
-/*
- * Structure defining parameters for the HeapBuf module
- */
-struct heapbuf_params {
- void *gate;
- bool exact; /* Only allocate on exact match of rquested size */
- char *name; /* Name when using nameserver */
- int resource_id; /* Resource id of the hardware linked list */
- bool cache_flag; /* Whether to perform cache coherency calls */
- u32 align; /* Alignment (in MAUs, power of 2) of each block */
- u32 num_blocks; /* Number of fixed-size blocks */
- u32 block_size; /* Size (in MAUs) of each block*/
- void *shared_addr; /* Physical address of the shared memory */
- u32 shared_addr_size; /* Size of shareAddr */
- void *shared_buf; /* Physical address of the shared buffers */
- u32 shared_buf_size; /* Size of sharedBuf */
-};
-
-/*
- * Stats structure for the getExtendedStats API.
- */
-struct heapbuf_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*/
-};
-
-
-/*
- * Function to get default configuration for the heapbuf module
- */
-int heapbuf_get_config(struct heapbuf_config *cfgparams);
-
-/*
- * Function to setup the heapbuf module
- */
-int heapbuf_setup(const struct heapbuf_config *cfg);
-
-/*
- * Function to destroy the heapbuf module
- */
-int heapbuf_destroy(void);
-
-/* Initialize this config-params structure with supplier-specified
- * defaults before instance creation
- */
-void heapbuf_params_init(void *handle, struct heapbuf_params *params);
-
-/*
- * Creates a new instance of heapbuf module
- */
-void *heapbuf_create(const struct heapbuf_params *params);
-
-/*
- * Deletes a instance of heapbuf module
- */
-int heapbuf_delete(void **handle_ptr);
-
-/*
- * Opens a created instance of heapbuf module
- */
-int heapbuf_open(void **handle_ptr, struct heapbuf_params *params);
-
-/*
- * Closes previously opened/created instance of heapbuf module
- */
-int heapbuf_close(void *handle_ptr);
-
-/*
- * Returns the amount of shared memory required for creation
- * of each instance
- */
-int heapbuf_shared_memreq(const struct heapbuf_params *params, u32 *buf_size);
-
-/*
- * Allocate a block
- */
-void *heapbuf_alloc(void *hphandle, u32 size, u32 align);
-
-/*
- * Frees the block to this heapbuf
- */
-int heapbuf_free(void *hphandle, void *block, u32 size);
-
-/*
- * Get memory statistics
- */
-int heapbuf_get_stats(void *hphandle, struct memory_stats *stats);
-
-/*
- * Indicate whether the heap may block during an alloc or free call
- */
-bool heapbuf_isblocking(void *handle);
-
-/*
- * Get extended statistics
- */
-int heapbuf_get_extended_stats(void *hphandle,
- struct heapbuf_extended_stats *stats);
-
-#endif /* _HEAPBUF_H_ */
diff --git a/arch/arm/plat-omap/include/syslink/heapbuf_ioctl.h b/arch/arm/plat-omap/include/syslink/heapbuf_ioctl.h
deleted file mode 100644
index 80165dcfc436..000000000000
--- a/arch/arm/plat-omap/include/syslink/heapbuf_ioctl.h
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * heapbuf_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 _HEAPBUF_IOCTL_
-#define _HEAPBUF_IOCTL_
-
-#include <linux/ioctl.h>
-#include <linux/types.h>
-
-#include <ipc_ioctl.h>
-#include <heap.h>
-#include <heapbuf.h>
-
-
-enum CMD_HEAPBUF {
- HEAPBUF_GETCONFIG = HEAPBUF_BASE_CMD,
- HEAPBUF_SETUP,
- HEAPBUF_DESTROY,
- HEAPBUF_PARAMS_INIT,
- HEAPBUF_CREATE,
- HEAPBUF_DELETE,
- HEAPBUF_OPEN,
- HEAPBUF_CLOSE,
- HEAPBUF_ALLOC,
- HEAPBUF_FREE,
- HEAPBUF_SHAREDMEMREQ,
- HEAPBUF_GETSTATS,
- HEAPBUF_GETEXTENDEDSTATS
-};
-
-/*
- * Command for heapbuf_get_config
- */
-#define CMD_HEAPBUF_GETCONFIG _IOWR(IPC_IOC_MAGIC, HEAPBUF_GETCONFIG,\
- struct heapbuf_cmd_args)
-
-/*
- * Command for heapbuf_setup
- */
-#define CMD_HEAPBUF_SETUP _IOWR(IPC_IOC_MAGIC, HEAPBUF_SETUP, \
- struct heapbuf_cmd_args)
-/*
- * Command for heapbuf_destroy
- */
-#define CMD_HEAPBUF_DESTROY _IOWR(IPC_IOC_MAGIC, HEAPBUF_DESTROY, \
- struct heapbuf_cmd_args)
-
-/*
- * Command for heapbuf_prams_init
- */
-#define CMD_HEAPBUF_PARAMS_INIT _IOWR(IPC_IOC_MAGIC, \
- HEAPBUF_PARAMS_INIT, \
- struct heapbuf_cmd_args)
-
-/*
- * Command for heapbuf_create
- */
-#define CMD_HEAPBUF_CREATE _IOWR(IPC_IOC_MAGIC, HEAPBUF_CREATE, \
- struct heapbuf_cmd_args)
-
-/*
- * Command for heapbuf_delete
- */
-#define CMD_HEAPBUF_DELETE _IOWR(IPC_IOC_MAGIC, HEAPBUF_DELETE, \
- struct heapbuf_cmd_args)
-
-/*
- * Command for heapbuf_open
- */
-#define CMD_HEAPBUF_OPEN _IOWR(IPC_IOC_MAGIC, HEAPBUF_OPEN, \
- struct heapbuf_cmd_args)
-
-/*
- * Command for heapbuf_close
- */
-#define CMD_HEAPBUF_CLOSE _IOWR(IPC_IOC_MAGIC, HEAPBUF_CLOSE, \
- struct heapbuf_cmd_args)
-
-/*
- * Command for heapbuf_alloc
- */
-#define CMD_HEAPBUF_ALLOC _IOWR(IPC_IOC_MAGIC, HEAPBUF_ALLOC, \
- struct heapbuf_cmd_args)
-
-/*
- * Command for heapbuf_free
- */
-#define CMD_HEAPBUF_FREE _IOWR(IPC_IOC_MAGIC, HEAPBUF_FREE, \
- struct heapbuf_cmd_args)
-
-/*
- * Command for heapbuf_shared_memreq
- */
-#define CMD_HEAPBUF_SHAREDMEMREQ _IOWR(IPC_IOC_MAGIC, \
- HEAPBUF_SHAREDMEMREQ, \
- struct heapbuf_cmd_args)
-
-/*
- * Command for heapbuf_get_stats
- */
-#define CMD_HEAPBUF_GETSTATS _IOWR(IPC_IOC_MAGIC, \
- HEAPBUF_GETSTATS, \
- struct heapbuf_cmd_args)
-
-/*
- * Command for heapbuf_get_extended_stats
- */
-#define CMD_HEAPBUF_GETEXTENDEDSTATS _IOWR(IPC_IOC_MAGIC, \
- HEAPBUF_GETEXTENDEDSTATS, \
- struct heapbuf_cmd_args)
-
-
-/*
- * Command arguments for heapbuf
- */
-union heapbuf_arg {
- struct {
- void *handle;
- struct heapbuf_params *params;
- } params_init;
-
- struct {
- struct heapbuf_config *config;
- } get_config;
-
- struct {
- struct heapbuf_config *config;
- } setup;
-
- struct {
- void *handle;
- struct heapbuf_params *params;
- u32 name_len;
- u32 *shared_addr_srptr;
- u32 *shared_buf_srptr;
- void *knl_gate;
- } create;
-
- struct {
- void *handle;
- } delete;
-
- struct {
- void *handle;
- struct heapbuf_params *params;
- u32 name_len;
- u32 *shared_addr_srptr;
- void *knl_gate;
- } open;
-
- 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 heapbuf_extended_stats *stats;
- } get_extended_stats;
-
- struct {
- void *handle;
- struct heapbuf_params *params;
- u32 buf_size;
- u32 bytes;
- } shared_memreq;
-};
-
-/*
- * Command arguments for heapbuf
- */
-struct heapbuf_cmd_args{
- union heapbuf_arg args;
- s32 api_status;
-};
-
-/*
- * This ioctl interface for heapbuf module
- */
-int heapbuf_ioctl(struct inode *pinode, struct file *filp,
- unsigned int cmd, unsigned long args);
-
-#endif /* _HEAPBUF_IOCTL_ */
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 000000000000..56699f3bc968
--- /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 000000000000..5c801487fc11
--- /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);
+
+#endif /* _HEAPBUFMP_IOCTL_ */