Update of /cvsroot/gc-linux/linux/include/asm-powerpc
In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv31297/include/asm-powerpc
Modified Files:
starlet.h
Log Message:
- rename functions: start_ios_* -> starlet_*
- add io heap library based on the existing kernel remote heap
Index: starlet.h
===================================================================
RCS file: /cvsroot/gc-linux/linux/include/asm-powerpc/starlet.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- starlet.h 12 Apr 2008 17:22:29 -0000 1.4
+++ starlet.h 2 Jul 2008 20:37:05 -0000 1.5
@@ -17,23 +17,44 @@
#include <linux/types.h>
#include <linux/spinlock_types.h>
+#include <linux/platform_device.h>
#include <linux/dmapool.h>
+#include <linux/dma-mapping.h>
#include <linux/list.h>
-#include <linux/platform_device.h>
#include <linux/scatterlist.h>
+#include <linux/timer.h>
+#include <asm/rheap.h>
#define STARLET_IPC_DMA_ALIGN 0x1f /* 32 bytes */
struct starlet_ipc_request;
+/* input/output heap */
+struct starlet_ioh {
+ spinlock_t lock;
+ rh_info_t *rheap;
+ unsigned long base_phys;
+ void *base;
+ size_t size;
+};
+
+/* pseudo-scatterlist support for the input/output heap */
+struct starlet_ioh_sg {
+ void *buf;
+ size_t len;
+ dma_addr_t dma_addr;
+};
+
+/* inter-process communication device abstraction */
struct starlet_ipc_device {
unsigned long flags;
void __iomem *io_base;
int irq;
- struct dma_pool *dma_pool;
+ struct dma_pool *dma_pool; /* to allocate requests */
+ struct starlet_ioh *ioh; /* to allocate special io buffers */
spinlock_t list_lock;
struct list_head outstanding_list;
@@ -41,11 +62,14 @@
struct list_head pending_list;
unsigned long nr_pending;
+ struct timer_list timer;
+
struct starlet_ipc_request *req; /* for requests causing a ios reboot */
struct device *dev;
};
+/* iovec entry suitable for ioctlv */
struct starlet_iovec {
dma_addr_t dma_addr;
u32 dma_len;
@@ -55,31 +79,31 @@
struct starlet_ipc_request {
/* begin starlet firmware request format */
- u32 cmd;
- s32 result;
- union {
+ u32 cmd; /* 0x00 */
+ s32 result; /* 0x04 */
+ union { /* 0x08 */
s32 fd;
u32 req_cmd;
};
union {
struct {
- dma_addr_t pathname;
- u32 mode;
+ dma_addr_t pathname; /* 0x0c */
+ u32 mode; /* 0x10 */
} open;
struct {
- u32 request;
- dma_addr_t ibuf;
- u32 ilen;
- dma_addr_t obuf;
- u32 olen;
+ u32 request; /* 0x0c */
+ dma_addr_t ibuf; /* 0x10 */
+ u32 ilen; /* 0x14 */
+ dma_addr_t obuf; /* 0x18 */
+ u32 olen; /* 0x1c */
} ioctl;
struct {
- u32 request;
- u32 argc_in;
- u32 argc_out;
- dma_addr_t iovec_da;
+ u32 request; /* 0x0c */
+ u32 argc_in; /* 0x10 */
+ u32 argc_io; /* 0x14 */
+ dma_addr_t iovec_da; /* 0x18 */
} ioctlv;
- u32 argv[5];
+ u32 argv[5]; /* 0x0c,0x10,0x14,0x18,0x1c */
};
/* end starlet firmware request format */
@@ -89,14 +113,24 @@
struct starlet_iovec *iovec;
size_t iovec_size;
- struct scatterlist *sgl_in;
unsigned sgl_nents_in;
- struct scatterlist *sgl_out;
- unsigned sgl_nents_out;
+ unsigned sgl_nents_io;
+ union {
+ struct scatterlist *sgl_in;
+ struct starlet_ioh_sg *ioh_sgl_in;
+ };
+ union {
+ struct scatterlist *sgl_io;
+ struct starlet_ioh_sg *ioh_sgl_io;
+ };
void *done_data;
starlet_ipc_callback_t done;
+ starlet_ipc_callback_t complete;
+
+ unsigned long jiffies;
+
struct list_head node; /* for queueing */
struct starlet_ipc_device *ipc_dev;
@@ -104,47 +138,83 @@
-/* from starlet-ipc.c */
+/* from starlet-malloc.c */
+
+extern int starlet_malloc_lib_bootstrap(struct resource *mem);
extern void *starlet_kzalloc(size_t size, gfp_t flags);
extern void starlet_kfree(void *ptr);
+extern void *starlet_ioh_kzalloc(size_t size);
+extern void starlet_ioh_kfree(void *ptr);
+
+extern unsigned long starlet_ioh_virt_to_phys(void *ptr);
+
+extern void starlet_ioh_sg_init_table(struct starlet_ioh_sg *sgl,
+ unsigned int nents);
+extern void starlet_ioh_sg_set_buf(struct starlet_ioh_sg *sg,
+ void *buf, size_t len);
+
+#define starlet_ioh_for_each_sg(sgl, sg, nr, __i) \
+ for (__i = 0, sg = (sgl); __i < nr; __i++, sg++)
+
+extern int starlet_ioh_dma_map_sg(struct device *dev,
+ struct starlet_ioh_sg *sgl, int nents,
+ enum dma_data_direction direction);
+extern void starlet_ioh_dma_unmap_sg(struct device *dev,
+ struct starlet_ioh_sg *sgl, int nents,
+ enum dma_data_direction direction);
+/* from starlet-ipc.c */
+
extern struct starlet_ipc_device *starlet_ipc_get_device(void);
-extern void *starlet_ipc_request_priv(struct starlet_ipc_request *req);
+
+extern struct starlet_ipc_request *
+starlet_ipc_alloc_request(struct starlet_ipc_device *ipc_dev, gfp_t flags);
extern void starlet_ipc_free_request(struct starlet_ipc_request *req);
-extern int starlet_ios_open(const char *pathname, int flags);
-extern int starlet_ios_close(int fd);
+extern int starlet_open(const char *pathname, int flags);
+extern int starlet_close(int fd);
-extern int starlet_ios_ioctl(int fd, int request,
+extern int starlet_ioctl(int fd, int request,
void *ibuf, size_t ilen,
void *obuf, size_t olen);
-extern int starlet_ios_ioctl_nowait(int fd, int request,
+extern int starlet_ioctl_nowait(int fd, int request,
void *ibuf, size_t ilen,
void *obuf, size_t olen,
starlet_ipc_callback_t callback,
void *arg);
-extern void starlet_ios_ioctl_complete(struct starlet_ipc_request *req);
-extern int starlet_ios_ioctlv(int fd, int request,
+extern int starlet_ioctlv(int fd, int request,
unsigned int nents_in,
struct scatterlist *sgl_in,
unsigned int nents_out,
struct scatterlist *sgl_out);
-extern int starlet_ios_ioctlv_nowait(int fd, int request,
+extern int starlet_ioctlv_nowait(int fd, int request,
unsigned int nents_in,
struct scatterlist *sgl_in,
unsigned int nents_out,
struct scatterlist *sgl_out,
starlet_ipc_callback_t callback,
void *arg);
-extern int starlet_ios_ioctlv_and_reboot(int fd, int request,
+extern int starlet_ioctlv_and_reboot(int fd, int request,
unsigned int nents_in,
struct scatterlist *sgl_in,
unsigned int nents_out,
struct scatterlist *sgl_out);
-extern void starlet_ios_ioctlv_complete(struct starlet_ipc_request *req);
+
+extern int starlet_ioh_ioctlv(int fd, int request,
+ unsigned int nents_in,
+ struct starlet_ioh_sg *ioh_sgl_in,
+ unsigned int nents_io,
+ struct starlet_ioh_sg *ioh_sgl_io);
+extern int starlet_ioh_ioctlv_nowait(int fd, int request,
+ unsigned int nents_in,
+ struct starlet_ioh_sg *ioh_sgl_in,
+ unsigned int nents_io,
+ struct starlet_ioh_sg *ioh_sgl_io,
+ starlet_ipc_callback_t callback,
+ void *arg);
/* from starlet-stm.c */
|