blob: 46e916b36c708989a24a72cf40fe11c2adb6da11 [file] [log] [blame]
Frank Haverkamp12eb4682013-12-09 13:30:39 +01001#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@de.ibm.com>
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>
Frank Haverkamp65861ab2013-12-20 16:26:11 +010034#include <linux/printk.h>
Frank Haverkamp12eb4682013-12-09 13:30:39 +010035
Frank Haverkamp58d66ce2013-12-20 16:26:10 +010036#include <asm/byteorder.h>
Frank Haverkamp12eb4682013-12-09 13:30:39 +010037#include <linux/genwqe/genwqe_card.h>
38
39#define DRV_VERS_STRING "2.0.0"
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 */
55struct 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 */
61void ddcb_requ_free(struct genwqe_ddcb_cmd *req);
62
63u32 genwqe_crc32(u8 *buff, size_t len, u32 init);
64
65static 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));
Frank Haverkamp65861ab2013-12-20 16:26:11 +010072
73 print_hex_dump_debug(prefix, DUMP_PREFIX_OFFSET, 16, 1, buff,
74 size, true);
Frank Haverkamp12eb4682013-12-09 13:30:39 +010075}
76
77#endif /* __GENWQE_DRIVER_H__ */