Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 #ifndef __GENWQE_DRIVER_H__
0003 #define __GENWQE_DRIVER_H__
0004 
0005 /**
0006  * IBM Accelerator Family 'GenWQE'
0007  *
0008  * (C) Copyright IBM Corp. 2013
0009  *
0010  * Author: Frank Haverkamp <haver@linux.vnet.ibm.com>
0011  * Author: Joerg-Stephan Vogt <jsvogt@de.ibm.com>
0012  * Author: Michael Jung <mijung@gmx.net>
0013  * Author: Michael Ruettger <michael@ibmra.de>
0014  */
0015 
0016 #include <linux/types.h>
0017 #include <linux/stddef.h>
0018 #include <linux/cdev.h>
0019 #include <linux/list.h>
0020 #include <linux/kthread.h>
0021 #include <linux/scatterlist.h>
0022 #include <linux/iommu.h>
0023 #include <linux/spinlock.h>
0024 #include <linux/mutex.h>
0025 #include <linux/platform_device.h>
0026 #include <linux/printk.h>
0027 
0028 #include <asm/byteorder.h>
0029 #include <linux/genwqe/genwqe_card.h>
0030 
0031 #define DRV_VERSION     "2.0.25"
0032 
0033 /*
0034  * Static minor number assignement, until we decide/implement
0035  * something dynamic.
0036  */
0037 #define GENWQE_MAX_MINOR    128 /* up to 128 possible genwqe devices */
0038 
0039 /**
0040  * genwqe_requ_alloc() - Allocate a new DDCB execution request
0041  *
0042  * This data structure contains the user visiable fields of the DDCB
0043  * to be executed.
0044  *
0045  * Return: ptr to genwqe_ddcb_cmd data structure
0046  */
0047 struct genwqe_ddcb_cmd *ddcb_requ_alloc(void);
0048 
0049 /**
0050  * ddcb_requ_free() - Free DDCB execution request.
0051  * @req:       ptr to genwqe_ddcb_cmd data structure.
0052  */
0053 void ddcb_requ_free(struct genwqe_ddcb_cmd *req);
0054 
0055 u32  genwqe_crc32(u8 *buff, size_t len, u32 init);
0056 
0057 static inline void genwqe_hexdump(struct pci_dev *pci_dev,
0058                   const void *buff, unsigned int size)
0059 {
0060     char prefix[32];
0061 
0062     scnprintf(prefix, sizeof(prefix), "%s %s: ",
0063           GENWQE_DEVNAME, pci_name(pci_dev));
0064 
0065     print_hex_dump_debug(prefix, DUMP_PREFIX_OFFSET, 16, 1, buff,
0066                  size, true);
0067 }
0068 
0069 #endif  /* __GENWQE_DRIVER_H__ */