Add the rt linux 4.1.3-rt3 as base
[kvmfornfv.git] / kernel / drivers / misc / genwqe / genwqe_driver.h
1 #ifndef __GENWQE_DRIVER_H__
2 #define __GENWQE_DRIVER_H__
3
4 /**
5  * IBM Accelerator Family 'GenWQE'
6  *
7  * (C) Copyright IBM Corp. 2013
8  *
9  * Author: Frank Haverkamp <haver@linux.vnet.ibm.com>
10  * Author: Joerg-Stephan Vogt <jsvogt@de.ibm.com>
11  * Author: Michael Jung <mijung@gmx.net>
12  * Author: Michael Ruettger <michael@ibmra.de>
13  *
14  * This program is free software; you can redistribute it and/or modify
15  * it under the terms of the GNU General Public License (version 2 only)
16  * as published by the Free Software Foundation.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  */
23
24 #include <linux/types.h>
25 #include <linux/stddef.h>
26 #include <linux/cdev.h>
27 #include <linux/list.h>
28 #include <linux/kthread.h>
29 #include <linux/scatterlist.h>
30 #include <linux/iommu.h>
31 #include <linux/spinlock.h>
32 #include <linux/mutex.h>
33 #include <linux/platform_device.h>
34 #include <linux/printk.h>
35
36 #include <asm/byteorder.h>
37 #include <linux/genwqe/genwqe_card.h>
38
39 #define DRV_VERSION             "2.0.25"
40
41 /*
42  * Static minor number assignement, until we decide/implement
43  * something dynamic.
44  */
45 #define GENWQE_MAX_MINOR        128 /* up to 128 possible genwqe devices */
46
47 /**
48  * genwqe_requ_alloc() - Allocate a new DDCB execution request
49  *
50  * This data structure contains the user visiable fields of the DDCB
51  * to be executed.
52  *
53  * Return: ptr to genwqe_ddcb_cmd data structure
54  */
55 struct genwqe_ddcb_cmd *ddcb_requ_alloc(void);
56
57 /**
58  * ddcb_requ_free() - Free DDCB execution request.
59  * @req:       ptr to genwqe_ddcb_cmd data structure.
60  */
61 void ddcb_requ_free(struct genwqe_ddcb_cmd *req);
62
63 u32  genwqe_crc32(u8 *buff, size_t len, u32 init);
64
65 static inline void genwqe_hexdump(struct pci_dev *pci_dev,
66                                   const void *buff, unsigned int size)
67 {
68         char prefix[32];
69
70         scnprintf(prefix, sizeof(prefix), "%s %s: ",
71                   GENWQE_DEVNAME, pci_name(pci_dev));
72
73         print_hex_dump_debug(prefix, DUMP_PREFIX_OFFSET, 16, 1, buff,
74                              size, true);
75 }
76
77 #endif  /* __GENWQE_DRIVER_H__ */