PM / sleep: Asynchronous threads for suspend_noirq
[linux/fpc-iii.git] / drivers / infiniband / hw / usnic / usnic_uiom.h
blob70440996e8f2cbee289fb137d16dbd7ece78d345
1 /*
2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved.
4 * This program is free software; you may redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License.
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
10 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
11 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
12 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
13 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
14 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
15 * SOFTWARE.
19 #ifndef USNIC_UIOM_H_
20 #define USNIC_UIOM_H_
22 #include <linux/list.h>
23 #include <linux/scatterlist.h>
25 #include "usnic_uiom_interval_tree.h"
27 #define USNIC_UIOM_READ (1)
28 #define USNIC_UIOM_WRITE (2)
30 #define USNIC_UIOM_MAX_PD_CNT (1000)
31 #define USNIC_UIOM_MAX_MR_CNT (1000000)
32 #define USNIC_UIOM_MAX_MR_SIZE (~0UL)
33 #define USNIC_UIOM_PAGE_SIZE (PAGE_SIZE)
35 struct usnic_uiom_dev {
36 struct device *dev;
37 struct list_head link;
40 struct usnic_uiom_pd {
41 struct iommu_domain *domain;
42 spinlock_t lock;
43 struct rb_root rb_root;
44 struct list_head devs;
45 int dev_cnt;
48 struct usnic_uiom_reg {
49 struct usnic_uiom_pd *pd;
50 unsigned long va;
51 size_t length;
52 int offset;
53 int page_size;
54 int writable;
55 struct list_head chunk_list;
56 struct work_struct work;
57 struct mm_struct *mm;
58 unsigned long diff;
61 struct usnic_uiom_chunk {
62 struct list_head list;
63 int nents;
64 struct scatterlist page_list[0];
67 struct usnic_uiom_pd *usnic_uiom_alloc_pd(void);
68 void usnic_uiom_dealloc_pd(struct usnic_uiom_pd *pd);
69 int usnic_uiom_attach_dev_to_pd(struct usnic_uiom_pd *pd, struct device *dev);
70 void usnic_uiom_detach_dev_from_pd(struct usnic_uiom_pd *pd,
71 struct device *dev);
72 struct device **usnic_uiom_get_dev_list(struct usnic_uiom_pd *pd);
73 void usnic_uiom_free_dev_list(struct device **devs);
74 struct usnic_uiom_reg *usnic_uiom_reg_get(struct usnic_uiom_pd *pd,
75 unsigned long addr, size_t size,
76 int access, int dmasync);
77 void usnic_uiom_reg_release(struct usnic_uiom_reg *uiomr, int closing);
78 int usnic_uiom_init(char *drv_name);
79 void usnic_uiom_fini(void);
80 #endif /* USNIC_UIOM_H_ */