1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 #ifndef __GENWQE_DRIVER_H__ 3 #define __GENWQE_DRIVER_H__ 4 5 /** 6 * IBM Accelerator Family 'GenWQE' 7 * 8 * (C) Copyright IBM Corp. 2013 9 * 10 * Author: Frank Haverkamp <haver@linux.vnet.ibm.com> 11 * Author: Joerg-Stephan Vogt <jsvogt@de.ibm.com> 12 * Author: Michael Jung <mijung@gmx.net> 13 * Author: Michael Ruettger <michael@ibmra.de> 14 */ 15 16 #include <linux/types.h> 17 #include <linux/stddef.h> 18 #include <linux/cdev.h> 19 #include <linux/list.h> 20 #include <linux/kthread.h> 21 #include <linux/scatterlist.h> 22 #include <linux/iommu.h> 23 #include <linux/spinlock.h> 24 #include <linux/mutex.h> 25 #include <linux/platform_device.h> 26 #include <linux/printk.h> 27 28 #include <asm/byteorder.h> 29 #include <linux/genwqe/genwqe_card.h> 30 31 #define DRV_VERSION "2.0.25" 32 33 /* 34 * Static minor number assignement, until we decide/implement 35 * something dynamic. 36 */ 37 #define GENWQE_MAX_MINOR 128 /* up to 128 possible genwqe devices */ 38 39 /** 40 * genwqe_requ_alloc() - Allocate a new DDCB execution request 41 * 42 * This data structure contains the user visiable fields of the DDCB 43 * to be executed. 44 * 45 * Return: ptr to genwqe_ddcb_cmd data structure 46 */ 47 struct genwqe_ddcb_cmd *ddcb_requ_alloc(void); 48 49 /** 50 * ddcb_requ_free() - Free DDCB execution request. 51 * @req: ptr to genwqe_ddcb_cmd data structure. 52 */ 53 void ddcb_requ_free(struct genwqe_ddcb_cmd *req); 54 55 u32 genwqe_crc32(u8 *buff, size_t len, u32 init); 56 57 static inline void genwqe_hexdump(struct pci_dev *pci_dev, 58 const void *buff, unsigned int size) 59 { 60 char prefix[32]; 61 62 scnprintf(prefix, sizeof(prefix), "%s %s: ", 63 GENWQE_DEVNAME, pci_name(pci_dev)); 64 65 print_hex_dump_debug(prefix, DUMP_PREFIX_OFFSET, 16, 1, buff, 66 size, true); 67 } 68 69 #endif /* __GENWQE_DRIVER_H__ */ 70