video: tegra: nvmap: implement fast api functions
[linux-2.6.git] / include / linux / nvmap.h
index 553a7bd..12949e7 100644 (file)
@@ -3,7 +3,7 @@
  *
  * structure declarations for nvmem and nvmap user-space ioctls
  *
- * Copyright (c) 2009-2012, NVIDIA Corporation.
+ * Copyright (c) 2009-2012, NVIDIA CORPORATION. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -23,6 +23,7 @@
 #include <linux/ioctl.h>
 #include <linux/file.h>
 #include <linux/rbtree.h>
+#include <linux/dma-buf.h>
 
 #if !defined(__KERNEL__)
 #define __user
@@ -37,6 +38,7 @@
 /* common carveout heaps */
 #define NVMAP_HEAP_CARVEOUT_IRAM    (1ul<<29)
 #define NVMAP_HEAP_CARVEOUT_VPR     (1ul<<28)
+#define NVMAP_HEAP_CARVEOUT_TSEC    (1ul<<27)
 #define NVMAP_HEAP_CARVEOUT_GENERIC (1ul<<0)
 
 #define NVMAP_HEAP_CARVEOUT_MASK    (NVMAP_HEAP_IOVMM - 1)
@@ -49,6 +51,7 @@
 #define NVMAP_HANDLE_CACHE_FLAG      (0x3ul << 0)
 
 #define NVMAP_HANDLE_SECURE          (0x1ul << 2)
+#define NVMAP_HANDLE_ZEROED_PAGES    (0x1ul << 3)
 
 #if defined(__KERNEL__)
 
@@ -99,12 +102,21 @@ struct nvmap_handle_ref *nvmap_alloc(struct nvmap_client *client, size_t size,
                                     size_t align, unsigned int flags,
                                     unsigned int heap_mask);
 
+phys_addr_t _nvmap_get_addr_from_id(u32 id);
+
 void nvmap_free(struct nvmap_client *client, struct nvmap_handle_ref *r);
 
+void _nvmap_free(struct nvmap_client *client, struct nvmap_handle_ref *r);
+
 void *nvmap_mmap(struct nvmap_handle_ref *r);
 
 void nvmap_munmap(struct nvmap_handle_ref *r, void *addr);
 
+void *nvmap_kmap(struct nvmap_handle_ref *r, unsigned int pagenum);
+
+void nvmap_kunmap(struct nvmap_handle_ref *r, unsigned int pagenum,
+               void *addr);
+
 struct nvmap_client *nvmap_client_get_file(int fd);
 
 struct nvmap_client *nvmap_client_get(struct nvmap_client *client);
@@ -112,6 +124,8 @@ struct nvmap_client *nvmap_client_get(struct nvmap_client *client);
 void nvmap_client_put(struct nvmap_client *c);
 
 phys_addr_t nvmap_pin(struct nvmap_client *c, struct nvmap_handle_ref *r);
+phys_addr_t _nvmap_pin(struct nvmap_client *c, struct nvmap_handle_ref *r);
+
 
 phys_addr_t nvmap_handle_address(struct nvmap_client *c, unsigned long id);
 
@@ -122,6 +136,17 @@ void nvmap_unpin_handles(struct nvmap_client *client,
 
 struct nvmap_handle_ref *nvmap_duplicate_handle_id(struct nvmap_client *client,
                                                   unsigned long id);
+struct nvmap_handle_ref *_nvmap_duplicate_handle_id(struct nvmap_client *client,
+                                                  unsigned long id);
+
+int nvmap_pin_array(struct nvmap_client *client,
+               unsigned long    *ids,
+               long unsigned id_type_mask,
+               long unsigned id_type,
+               int nr,
+               struct nvmap_handle **unique_arr,
+               struct nvmap_handle_ref **unique_arr_refs);
+
 
 struct nvmap_platform_carveout {
        const char *name;
@@ -138,6 +163,17 @@ struct nvmap_platform_data {
 
 extern struct nvmap_device *nvmap_dev;
 
+#ifdef CONFIG_DMA_SHARED_BUFFER
+/* dma-buf exporter */
+struct dma_buf *nvmap_share_dmabuf(struct nvmap_client *client, u32 id);
+#else
+static inline struct dma_buf *nvmap_share_dmabuf(struct nvmap_client *client,
+                                                u32 id)
+{
+       return NULL;
+}
+#endif /* !CONFIG_DMA_SHARED_BUFFER */
+
 #endif /* __KERNEL__ */
 
 #endif /* _LINUX_NVMAP_H */